
package com.judy.hibernate.controller;


import org.hibernate.Session;


import com.judy.hibernate.domain.Person;
import com.judy.hibernate.util.HibernateUtil;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
	 
	public class PersonController {
		private static final Log log = LogFactory.getLog(PersonController.class);
		public static void main(String[] args) {
	 
		System.out.println("Hibernate component mapping");
		Session session = HibernateUtil.getSessionFactory().openSession();
	 
		session.beginTransaction();
	 
		Person person = new Person();
		person.setAddress("Singapore");
		person.setAge(11);
		person.setGentle("F");
		person.setName("Judy");
		
	 
	    session.save(person);
	    
	 
		session.getTransaction().commit();
		//System.out.println("Done");
		
		log.info ("GGG: Hey there" );
		log.debug ("GGG: Ooooh. A bug!" );
		log.error ("GGG: Ouch! An error!");
		log.warn("GGG: Be careful!" );
		log.trace("GGG: tracing here!");

		
		}
	
}
